<?php
if(isset($_POST['identifiant'])&&isset($_POST['mdp']) || isset($_POST['type']))
{
	include_once('class/autoload.php');
	$controleur = new controleur();
	if(isset($_POST['type'])&&$_POST['type']=='connexion'){
		$requete = new PreparationREQ ($controleur-> GetConnectBD());
		$connexion = $requete->Connexion($_POST['identifiant'], $_POST['mdp']);
		
		if($connexion>0){
			$controleur->creasession($_POST['identifiant']);
			$_SESSION ['current_id'] = $connexion ['idecole'];
		}
	}
	if(isset($_POST['type'])&&$_POST['type']=='deconnexion'){
		$controleur->deconnexion();
	}
}
else {

	header('location:index.php');
}
?>